package com.jk.admin.service;

import com.jk.admin.dao.OrderDao;
import com.jk.admin.entity.Order;
import com.jk.admin.entity.OrderItem;
import com.jk.admin.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class OrderService {

    @Autowired
    private OrderDao orderDao;

    public List<Order> GetOrderList(Order order,String userid) {

        List<Order> orders = orderDao.GetOrderList(order,userid);
        for (Order  order1:orders) {
            String oid = order1.getOrder_id();
            List<OrderItem> orderItems=orderDao.getOrderItem(oid);
            order1.setOrderItems(orderItems);
        }
        return orders;
    }


    public void delOrderId(String[] ids) {
        orderDao.delOrderId(ids);
    }

    public void adupPage(String id) {
        orderDao.adupPage(id);
    }


//    public void addorder(Order order) {
//         orderDao.aaddorder(order);
//    }
//
//    public void upadorder(Order order) {
//        orderDao.upadorder(order);
//    }
//
//    public Order getOrderiD(String id) {
//        return orderDao.getOrderiD(id);
//    }
}
